

<template>
  <div class="app-container" style="padding: 20px;">
    <div>
      <el-button @click="()=>triggerModify()">添加</el-button>
    </div>
    <el-table
      ref="multipleTable"
      :data="lists"
      tooltip-effect="dark"
      style="width: 100%"
      @selection-change="(rows)=>selectRows=rows">
      <el-table-column
        type="selection"
        width="25">
      </el-table-column>
     
             <el-table-column
            label="id" prop="id">
          </el-table-column>
        
             <el-table-column
            label="absolutPath" prop="absolutPath">
          </el-table-column>
        
             <el-table-column
            label="orgId" prop="orgId">
          </el-table-column>
        
      <el-table-column
        prop="address"
        label="操作"
        fixed="right">
        <template slot-scope="scope">
          <el-button type="text"  @click="()=>triggerModify(scope.row)">修改</el-button>
        <el-popconfirm
                            placement="bottom"
                            width="200"
                            trigger="click"
                            title="确定删除吗?"
                            @confirm="()=>deleteOne(scope.row.id)">
                        <el-button slot="reference" type="text" style="padding-left: 10px;">删除</el-button>
                    </el-popconfirm>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      style="padding: 20px;"
      :page-size="filter.pageSize"
      layout="prev, pager, next"
      :total="filter.total"
      @size-change="(pageSize)=>{$data.filter.pageSize=pageSize;lists=[];ajaxList();}"
      @current-change="(pageNum)=>{$data.filter.pageNum=pageNum;lists=[];ajaxList();}"
    >
    </el-pagination>

    <!--弹出框-->
    <modify class="vue" ref="modifyDialog" @refresh="()=>ajaxList()"></modify>
  </div>
</template>
<script>
  import axios from '@/utils/request'

  export default {
    components: {
      modify: () => import('./modify')
    },
    data() {
      return {
        filter: {
          pageNum: 0,
          pageSize: 10,
          total: 0,
        },
        lists: [],
        selectRows: [],
        showModify: false,
      }
    },
    mounted() {
      this.ajaxList();
    },
    methods: {
      async deleteOne(id){
                var result = await axios.get('/imageList/delete?id='+id).then(res => res.data).then(res => res.result)
                this.ajaxList();
            },
      triggerModify() {
        this.$refs['modifyDialog'].init()
      },
      async ajaxList() {
        var _params = {}
        console.log("[get]  /imageList/page")
        console.log('参数', JSON.stringify(_params))
        var result = await axios.get('/imageList/page?pageNum='+this.filter.pageNum+'&&pageSize='+this.filter.pageSize+'', _params).then(res => res.result)
        console.log("结果", result)
        this.lists = result.records
        this.filter.total = Number(result.total)
        this.filter.pageSize = Number(result.size)
      }
    }
  }
</script>



